package com.yang.controller;

import com.yang.dao.BooksMapper;
import com.yang.pojo.Books;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

@Controller
public class bookController {

    @Autowired
    BooksMapper booksMapper;

    @GetMapping("/hello")
    @ResponseBody
    public Object hello(HttpServletResponse resp)
    {
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("application/json");
        Books book=booksMapper.queryBookById(1);
        return book;
    }
}